//============================================================================
// Copyright (C) 2003-2013 Brett R. Jones 
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses 
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================

#include "PktFileChunk.h"
#include <VxUtilLib/vx_debug.h>

PktFileChunk::PktFileChunk()
{
    m_u16PktType = PKT_TYPE_FILE_CHUNK;
    m_u16PktLen = sizeof( PktFileChunk );
    u16Res = 0;
    u32ChunkLen = 0;
    u32ChkSum = 0;
    vx_assert( 0 == (m_u16PktLen & 0x0f ) );
}
void PktFileChunk::CalcPktLen( int iChunkLen )
{
    //calculate length of packet from length of file data
    m_u16PktLen = (U16)ROUND_TO_16BYTE_BOUNDRY( ( sizeof( PktFileChunk ) - MAX_FILE_CHUNK_LEN + iChunkLen) );
}



